package com.example.app.controller

import com.example.app.model.LoginParam
import com.example.app.model.User
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RestController

@RestController
class MyController {

    @GetMapping("/get-user")
    fun getUser(): User {
        return User(1, "张三", "root", "123456")
    }

    @PostMapping("/login")
    fun login(loginParam: LoginParam): String {
        return if (loginParam.username == "root" && loginParam.password == "123456") {
            "登录成功！"
        } else {
            "账号密码错误！"
        }
    }

}